package com.example.kotlin

// 定义一个 Person 类
class Person4(val name: String, val age: Int) {
    fun printInfo() {
        println("Person(name=$name, age=$age)")
    }
}

// 定义一个 Address 类
class Address(val street: String, val city: String) {
    fun printAddress() {
        println("Address(street=$street, city=$city)")
    }
}

// 定义一个 Car 类
class Car(val brand: String, val model: String) {
    fun printCarInfo() {
        println("Car(brand=$brand, model=$model)")
    }
}

// 可以在同一个文件中定义顶级函数
fun main() {
    val person = Person4("Alice", 30)
    person.printInfo()  // 输出：Person(name=Alice, age=30)

    val address = Address("5th Avenue", "New York")
    address.printAddress()  // 输出：Address(street=5th Avenue, city=New York)

    val car = Car("Tesla", "Model S")
    car.printCarInfo()  // 输出：Car(brand=Tesla, model=Model S)
}
